package com.ww.springboot.boot.algorithm.digui;

/**
 * 递归demo1        求1~n的和
 *
 * @author wanwei
 * @since 2021-03-03 10:20
 */
public class DiGuiDemo1 {


    public static void main(String[] args) {
        System.out.println(method(10));
    }


    private static int method(int n) {
        System.out.println(n);
        if (n == 0) {
            return 0;
        }
        return method(n - 1) + n;
    }
}
